Widgets > wijmenu > wijmenu Tutorial > wijmenu Step 3 of 3: Creating the View and Adding Wijmo Widgets |
In this example, we'll create a View showing a menu on the home page of the project. After that, we’ll use Razor syntax to get the Product Name for each product from the model.
Complete the following steps:
<ul id = “menu”> </ul>
<ul>
tags:
@foreach (var c in Model)
{
<li><a href="#">@c.CategoryName</a>
@if (c.Products != null && c.Products.Count > 0)
{
<ul>
@foreach (var p in c.Products)
{
<li><a href="#">@p.ProductName</a></li>
}
</ul>
}
</li>
}
Wijmo.<head>
tags. You can find the latest version of the Wijmo dependencies at http://wijmo.com/downloads/cdn/.</ul>
,enter the following jQuery script to initialize the wijmenu widget:
<script type="text/javascript">
$(document).ready(function () {
$("#menu").wijmenu();
});
</script>
If you click one of the menu items, a submenu will drop down: